<div id="orderOfferDetailFormDiv"></div>
<script type="text/html" id="orderOfferDetailFormContent">
    <form lay-filter="orderOfferDetailForm" id="orderOfferDetailForm" class="layui-form model-form open-form "
          style="padding: 5px 30px 0 30px;height: calc(100% - 5px);overflow: hidden;">
        <div class="open-model">
            <div style="height: calc(100% - 100px); padding-top: 20px;overflow: auto;margin-bottom: 20px"
                 class="open-auto">
                <div class="layui-form-item layui-row">
                    <input name="id" type="hidden"/>
                    <!--                <button class="layui-btn" type="button" id="addOffer">添加报价</button>-->
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">客户名称</label>
                        <div class="layui-input-inline">
                            <input name="customerName" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">客户联系人</label>
                        <div class="layui-input-inline">
                            <input name="customerContactsName" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">联系人电话</label>
                        <div class="layui-input-inline">
                            <input name="customerContactsPhone" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">交货时间</label>
                        <div class="layui-input-inline">
                            <input name="deliveryTime" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">所属渠道</label>
                        <div class="layui-input-inline">
                            <input name="channelName" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">订单类型</label>
                        <div class="layui-input-inline">
                            <select name="orderType" lay-verify="required" disabled>
                                <option value="trial">试产订单</option>
                            </select>

                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <input name="checkerName" type="hidden"/>
                        <label class="layui-form-label">询价审核人</label>
                        <div class="layui-input-inline">
                            <input name="checkerId" disabled class="layui-input" type="text"/>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">订单来源</label>
                        <div class="layui-input-inline">
                            <select name="orderSource" disabled>
                                <option value="staff">自主录入/员工录入</option>
                                <option value="platform">云端制造/平台指派</option>
                                <option value="agent">渠道录入/代理商录入</option>
                                <option value="customer">云端智采/客户直接委派</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline layui-col-md3">
                        <label class="layui-form-label">报价截止时间</label>
                        <div class="layui-input-inline">
                            <input name="offerEndTime" disabled class="layui-input" type="text"/>
                        </div>
                    </div>

                    <table class="layui-table" id="orderOfferDetailFormTable"
                           lay-filter="orderOfferDetailFormTable"></table>
                </div>

            </div>
    </form>

</script>
<script>
    layui.use(['layer', 'form', 'table', 'admin', 'upload', 'tree', 'laytpl'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var admin = layui.admin;
        var laydate = layui.laydate;
        var laytpl = layui.laytpl;
        let nowData = {...parentData}

        laytpl(orderOfferDetailFormContent.innerHTML).render(nowData, function (html) {
            $('#orderOfferDetailFormDiv').after(html);
        })
        console.log('offerDetail',nowData.offerDetail)
        if (nowData.orderObj) {
            form.val('orderOfferDetailForm', nowData.orderObj)
        }
        table.render({
            elem: '#orderOfferDetailFormTable',
            data: [...nowData.offerDetail],
            page: false,
            limit: 999999,
            cols: [[
                {type: 'numbers', title: '序号'},
                // {field: 'productDetailName', align: 'center', title: '内部SKU料号',},
                {field: 'skuCode', align: 'center', title: '内部SKU料号',},
                {field: 'customerSkuItem', align: 'center', title: '客户物料料号',},
                {field: 'customerSpecCode', align: 'center', title: '客户规格码',},
                {field: 'proUnitName', align: 'center', title: '单位',},
                {field: 'quantity', align: 'center', title: '数量',},
                {field: 'suggestPrice', align: 'center', title: '最低报价',},
                {field: 'suggestLowestPrice', align: 'center', title: '建议最低单价',},
                // {field: 'remark', align: 'center', title: '优惠价',},
                {field: 'offerStatusDesc', align: 'center', title: '状态',},
                // {field: 'lastMoney', align: 'center', title: '上次报价',},
                {field: 'offerMoney', align: 'center', title: '报价',},
                {field: 'offerRemark', align: 'center', title: '报价备注',},
            ]],
        })
        $('#addOffer').click(() => {
            admin.req('enterprise/sell/admin/order/detail/' + nowData.id, {}, function (res) {
                admin.formOpen({
                    area: ['90%', '85%'],
                    offset: ['50px', '5%'],
                    title: '添加报价',
                    style: 'font-size: 20px;',
                    path: 'components/sell/OrderForm.html',
                    success: function () {
                        parentData.data = res.data
                        parentData.eventName = 'quotationRecord'
                    }
                });
            })
            // return false;
        })
    })
</script>
<style>
    #orderOfferDetailForm .layui-form-label {
        width: 100px;
    }

    /* #orderOfferDetailForm .layui-form-item .layui-input-inline {
        width: 130px;
    } */

    #orderOfferDetailForm .layui-inline {
        margin-bottom: 10px;
        margin-right: 0px
    }

    #orderOfferDetailForm .layui-table-cell, .layui-table-tool-panel li {
        overflow: visible;
    }
</style>